
import 'package:dingtalk/core/values/values.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class THDrawerListContentView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        THListContentItem(
          leading: SvgPicture.asset('assets/icons/icon_qrcode.svg',
              width: kSize48, color: Colors.green),
          title: "二维码名片",
          trailing: SvgPicture.asset('assets/icons/icon_qrcode.svg',
              color: kColor99, width: kSize48),
        ),
        THListContentItem(
          leading:
              SvgPicture.asset('assets/icons/icon_wallet.svg', width: kSize48),
          title: "钱包（支付宝）",
        ),
        THListContentItem(
          leading:
              SvgPicture.asset('assets/icons/icon_service.svg', width: kSize48),
          title: "服务大厅",
        ),
        THListContentItem(
          leading:
              SvgPicture.asset('assets/icons/icon_folder.svg', width: kSize48),
          title: "收藏",
        ),
        THListContentItem(
          leading: SvgPicture.asset('assets/icons/icon_invitation.svg',
              width: kSize48),
          title: "邀请",
        ),
        THListContentItem(
          leading: SvgPicture.asset('assets/icons/icon_health_code.svg',
              width: kSize48),
          title: "我的健康码",
          trailing: Text(
            '限时',
            style: TextStyle(color: kColor99),
          ),
        ),
        THListContentItem(
          leading:
              SvgPicture.asset('assets/icons/icon_setting.svg', width: kSize48),
          title: "设置",
        ),
      ],
    );
  }
}

class THListContentItem extends StatelessWidget {
  final Widget leading;

  final Widget trailing;

  final String title;

  THListContentItem({this.leading, this.title, this.trailing});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(vertical: kSize30),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Widget>[
          Row(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              leading ?? SizedBox(),
              title != null
                  ? Padding(
                      padding: EdgeInsets.only(left: kSize28),
                      child: Text(
                        title ?? "",
                        style: TextStyle(color: kColor33, fontSize: kSize34),
                      ),
                    )
                  : SizedBox(),
            ],
          ),
          Row(
            children: <Widget>[
              trailing ?? SizedBox(),
              SvgPicture.asset(
                'assets/icons/icon_arrow_right.svg',
                width: kSize38,
                color: kColor99,
              ),
            ],
          )
        ],
      ),
    );
  }
}
